package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.ImportTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author: Bin.L
 * @date: 2021/11/2 0002 13:55
 * @Description:
 */
@Mapper
public interface ImportTableMapper extends BaseMapper<ImportTable> {


    /*SELECT COLUMN_NAME 列名,COLUMN_TYPE 数据类型,DATA_TYPE 字段类型,CHARACTER_MAXIMUM_LENGTH 长度,IS_NULLABLE 是否为空,
    COLUMN_DEFAULT 默认值,COLUMN_COMMENT 备注 FROM INFORMATION_SCHEMA.COLUMNS WHERE
        table_schema='huaihua_task' AND table_name='m_join_info'*/

    @Select("SELECT COLUMN_NAME name," +
            "DATA_TYPE type," +
            "CHARACTER_MAXIMUM_LENGTH length," +
            "COLUMN_COMMENT comment " +
            "FROM INFORMATION_SCHEMA.COLUMNS " +
            "WHERE table_schema='qrzt' AND table_name=#{tableName}")
    List<ImportTable> getTableProper(@Param("tableName") String tableName);
}
